import React, { Component } from 'react';
import '../styles/Setting.scss'
import { NavBar, Collapse} from 'antd-mobile'
class Setting extends Component {
    set() {
        this.props.history.go(-1)
    }
    user(){
        this.props.history.push('/user')
    }
    gopass(){
        this.props.history.push('/password')
    }
    login(){
        window.localStorage.clear()
        this.props.history.push('/login')
    }
    render() {
        return (
            <div className='setting'>
                <div className="top">
                    <NavBar onBack={() => { this.set() }}>设置</NavBar>
                </div>
                <div className="user">
                    <Collapse defaultActiveKey={['1']}>
                        <Collapse.Panel key='1' title='修改用户名' onClick={()=>{this.user()}}>
                        </Collapse.Panel>
                        <Collapse.Panel key='2' title='修改密码' onClick={()=>{this.gopass()}}>
                        </Collapse.Panel>
                    </Collapse>
                </div>
                <div className="btn">
                    <button  onClick={()=>{this.login()}}>退出登录</button>
                </div>
            </div>
        );
    }
}

export default Setting;